<h1>Images</h1>

<div class="desc">Grab an image from the photo library or from a photo taken. Then upload that image to
a web server. Take a look at the PHP exmaple included.</div>

<script>
/************************************
 * Images
 ************************************/
//Get information from device
function setImage() {
	//Set info listener
	lg.bind('lg_image_library', getImage);
	lg.bind('lg_image_camera', getImage);
}

//Listener for library call
var g=0;
function openLibraryToLocal(){
	lg.image.library({'url':'local', 'filename':'myPhoto'+g+'.jpg'});
	g++;
}
function openLibraryToAlbum(){
	lg.image.library({'url':'album', 'filename':'myPhoto'+g+'.jpg'});
	g++;
}
function openWebToAlbum(){
	lg.image.web({'url':'album', 'filename':'http://www.liquidgear.net/img/logo.png', 'quality':'1'});
	g++;
}
//Listener for library call
function openCamera(){
	lg.image.camera({'url':'local', 'filename':'myPhoto'+g+'.jpg'});
	g++;
}
//Listen for completion call
function getImage(e){
	$('#boxPhoto').css('backgroundImage', 'url(' + lg.image.file.url +')');
}
</script>

<a id="btnLibrary" class="button" href="javascript:openLibraryToLocal()">Library to Local</a>
<a id="btnLibrary" class="button" href="javascript:openLibraryToAlbum()">Library to Album</a>
<a id="btnLibrary" class="button" href="javascript:openWebToAlbum()">Web to Album</a>
<a id="btnCamera" class="button" href="javascript:openCamera()">Camera to Local</a>
<div id="boxPhoto"></div>